﻿using Clock.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using Wutos.App;

namespace Clock.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
            Wutos.App.SportApp sportApp = new Wutos.App.SportApp();
            List<Wutos.Domain.SportEntity> model=sportApp.GetList();
            return View(model);
        }
        public JsonResult Delete(int id)
        {
            SportApp app = new SportApp();
            app.Delete(id);
            return new JsonResult("OK");
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
